import { IPSCodeList } from '../../codelist/ipscode-list';
import { PSControlItemImpl2 } from '../pscontrol-item-impl2';
import { IPSChartCoordinateSystem } from './ipschart-coordinate-system';
import { IPSChartDataSet } from './ipschart-data-set';
import { IPSChartSeriesEncode } from './ipschart-series-encode';
import { IPSDEChart } from './ipsdechart';
import { IPSDEChartSeries } from './ipsdechart-series';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';

export class PSDEChartSeriesImpl extends PSControlItemImpl2 implements IPSDEChartSeries {
  get baseOptionJOString(): string {
    return this.M.baseOptionJOString;
  }

  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题语言资源对象');
    }
    return value;
  }

  get caption(): string {
    return this.M.caption;
  }

  get catalogField(): string {
    return this.M.catalogField;
  }

  protected catalogpscodelist: IPSCodeList | null = null;

  getCatalogPSCodeList(): IPSCodeList | null {
    if (this.catalogpscodelist != null) return this.catalogpscodelist;
    const value = this.M.getCatalogPSCodeList;
    if (value == null) {
      return null;
    }
    this.catalogpscodelist = this.getPSModel4('codelist.IPSCodeList', value, 'getCatalogPSCodeList') as IPSCodeList;
    return this.catalogpscodelist;
  }

  get catalogPSCodeList(): IPSCodeList | null {
    return this.getCatalogPSCodeList();
  }

  getCatalogPSCodeListMust(): IPSCodeList {
    const value = this.getCatalogPSCodeList();
    if (value == null) {
      throw new Error('未指定分类代码表对象');
    }
    return value;
  }

  get dataField(): string {
    return this.M.dataField;
  }

  get eChartsType(): 'area' | 'bar' | 'bar3d' | 'candlestick' | 'gauge' | 'line' | 'pie' | 'pie3d' | 'radar' | 'scatter' | 'column' | 'funnel' | 'map' | 'custom' {
    return this.M.eChartsType;
  }

  get extValue2Field(): string {
    return this.M.extValue2Field;
  }

  get extValue3Field(): string {
    return this.M.extValue3Field;
  }

  get extValue4Field(): string {
    return this.M.extValue4Field;
  }

  get extValueField(): string {
    return this.M.extValueField;
  }

  get groupMode(): 'YEAR' | 'QUARTER' | 'MONTH' | 'YEARWEEK' | 'DAY' | 'CODELIST' {
    return this.M.groupMode;
  }

  get idField(): string {
    return this.M.idField;
  }

  protected pschartcoordinatesystem: IPSChartCoordinateSystem | null = null;

  getPSChartCoordinateSystem(): IPSChartCoordinateSystem | null {
    if (this.pschartcoordinatesystem != null) return this.pschartcoordinatesystem;
    const value = this.M.getPSChartCoordinateSystem;
    if (value == null) {
      return null;
    }
    const ipsdechart = this.getParentPSModelObject('control.chart.IPSDEChart') as IPSDEChart;
    if (ipsdechart != null) {
      this.pschartcoordinatesystem = ipsdechart.findPSChartCoordinateSystem(value);
    }
    return this.pschartcoordinatesystem;
  }

  get psChartCoordinateSystem(): IPSChartCoordinateSystem | null {
    return this.getPSChartCoordinateSystem();
  }

  getPSChartCoordinateSystemMust(): IPSChartCoordinateSystem {
    const value = this.getPSChartCoordinateSystem();
    if (value == null) {
      throw new Error('未指定图表坐标系统');
    }
    return value;
  }

  protected pschartdataset: IPSChartDataSet | null = null;

  getPSChartDataSet(): IPSChartDataSet | null {
    if (this.pschartdataset != null) return this.pschartdataset;
    const value = this.M.getPSChartDataSet;
    if (value == null) {
      return null;
    }
    const ipsdechart = this.getParentPSModelObject('control.chart.IPSDEChart') as IPSDEChart;
    if (ipsdechart != null) {
      this.pschartdataset = ipsdechart.findPSChartDataSet(value);
    }
    return this.pschartdataset;
  }

  get psChartDataSet(): IPSChartDataSet | null {
    return this.getPSChartDataSet();
  }

  getPSChartDataSetMust(): IPSChartDataSet {
    const value = this.getPSChartDataSet();
    if (value == null) {
      throw new Error('未指定图表数据集对象');
    }
    return value;
  }

  protected pschartseriesencode: IPSChartSeriesEncode | null = null;

  getPSChartSeriesEncode(): IPSChartSeriesEncode | null {
    if (this.pschartseriesencode != null) return this.pschartseriesencode;
    const value = this.M.getPSChartSeriesEncode;
    if (value == null) {
      return null;
    }
    this.pschartseriesencode = this.getPSModel4('control.chart.IPSChartSeriesEncode', value, 'getPSChartSeriesEncode') as IPSChartSeriesEncode;
    return this.pschartseriesencode;
  }

  get psChartSeriesEncode(): IPSChartSeriesEncode | null {
    return this.getPSChartSeriesEncode();
  }

  getPSChartSeriesEncodeMust(): IPSChartSeriesEncode {
    const value = this.getPSChartSeriesEncode();
    if (value == null) {
      throw new Error('未指定图表序列编码');
    }
    return value;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  get sampleData(): string {
    return this.M.sampleData;
  }

  get seriesField(): string {
    return this.M.seriesField;
  }

  get seriesLayoutBy(): string {
    return this.M.seriesLayoutBy;
  }

  protected seriespscodelist: IPSCodeList | null = null;

  getSeriesPSCodeList(): IPSCodeList | null {
    if (this.seriespscodelist != null) return this.seriespscodelist;
    const value = this.M.getSeriesPSCodeList;
    if (value == null) {
      return null;
    }
    this.seriespscodelist = this.getPSModel4('codelist.IPSCodeList', value, 'getSeriesPSCodeList') as IPSCodeList;
    return this.seriespscodelist;
  }

  get seriesPSCodeList(): IPSCodeList | null {
    return this.getSeriesPSCodeList();
  }

  getSeriesPSCodeListMust(): IPSCodeList {
    const value = this.getSeriesPSCodeList();
    if (value == null) {
      throw new Error('未指定序列代码表对象');
    }
    return value;
  }

  get seriesType(): 'area' | 'bar' | 'bar3d' | 'candlestick' | 'gauge' | 'line' | 'pie' | 'pie3d' | 'radar' | 'scatter' | 'column' | 'funnel' | 'map' | 'custom' {
    return this.M.seriesType;
  }

  get tagField(): string {
    return this.M.tagField;
  }

  get valueField(): string {
    return this.M.valueField;
  }

  get enableChartDataSet(): boolean {
    return this.M.enableChartDataSet;
  }

  get cls(): string {
    return 'PSDEChartSeriesImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.chart.IPSDEChartSeries') return true;
    return super.instanceof(cls);
  }
}
